/*
 * Copyright (c) 2004 Your Corporation. All Rights Reserved.
 */
package net.borderwars.util;

import junit.framework.TestCase;

/**
 * @author ehubbard
 *         Date: Jul 13, 2004
 *         Time: 11:34:29 AM
 */
public class TestFormat extends TestCase {

    public void testSearchReplace () {
        String result = Format.searchAndReplace ("This\"\"so very neat stuff", "\"\"", "WOW");
        assertTrue ("One replace -- should be no double quotes --  " + result, "ThisWOWso very neat stuff".equals (result));
        result = Format.searchAndReplace ("ReplaceTWOthingsTWOcheck", "TWO", "2");
        assertTrue ("Two replace -- should be no TWO -- " + result, "Replace2things2check".equals (result));
        result = Format.searchAndReplace ("ReplaceTWOthingsTWOcheck", "blah", "2");
        assertTrue ("No replace -- should be no replace -- " + result, "ReplaceTWOthingsTWOcheck".equals (result));
    }

    public void testKb () {
        String s = Format.toCommaSizeString (1234);
        assertTrue (s, s.equals ("1kb"));
    }

    public void testMeg () {
        String s = Format.toCommaSizeString (12345678);
        assertTrue (s, s.equals ("12mb"));
    }

    public void testGig () {
        String s = Format.toCommaSizeString (123456789012l);
        assertTrue (s, s.equals ("123gb"));
    }

    public void testFormat () {
        String s = Format.toCommaString (123456789012l);
        assertTrue (s, s.length () == 15);
    }
}
